See this specific code
```{r}
#| eval: false
print(rock)
```GL
25 luglio 2025
area peri shape perm
Min. : 1016 Min. : 308.6 Min. :0.09033 Min. : 6.30
1st Qu.: 5305 1st Qu.:1414.9 1st Qu.:0.16226 1st Qu.: 76.45
Median : 7487 Median :2536.2 Median :0.19886 Median : 130.50
Mean : 7188 Mean :2682.2 Mean :0.21811 Mean : 415.45
3rd Qu.: 8870 3rd Qu.:3989.5 3rd Qu.:0.26267 3rd Qu.: 777.50
Max. :12212 Max. :4864.2 Max. :0.46413 Max. :1300.00
'data.frame': 300 obs. of 4 variables:
$ anxiety : num 50.2 31.5 34 37.1 48.3 ...
$ flexibility: num 44.4 47.7 65.6 50.7 51.3 ...
$ mindfulness: chr "no" "yes" "no" "no" ...
$ activity : chr "pilates" "altro" "pilates" "altro" ...
anxiety flexibility mindfulness activity
Min. : 1.483 Min. :26.91 Length:300 Length:300
1st Qu.:25.977 1st Qu.:44.24 Class :character Class :character
Median :33.922 Median :49.56 Mode :character Mode :character
Mean :33.418 Mean :50.34
3rd Qu.:41.974 3rd Qu.:56.32
Max. :64.775 Max. :82.41
Figura 1 illustrates a baby wearing a nirs cap with frontal probes.
Figura 2 illustrates a plot
mtcars
Tabella 1 show the summary of the ChickWeight dataset
| weight | Time | Chick | Diet | |
|---|---|---|---|---|
| Min. : 35.0 | Min. : 0.00 | 13 : 12 | 1:220 | |
| 1st Qu.: 63.0 | 1st Qu.: 4.00 | 9 : 12 | 2:120 | |
| Median :103.0 | Median :10.00 | 20 : 12 | 3:120 | |
| Mean :121.8 | Mean :10.72 | 10 : 12 | 4:118 | |
| 3rd Qu.:163.8 | 3rd Qu.:16.00 | 17 : 12 | NA | |
| Max. :373.0 | Max. :21.00 | 19 : 12 | NA | |
| NA | NA | (Other):506 | NA |
If you write “#| eval: false” in the previous code ref, quarto won’t return a table twice
'data.frame': 300 obs. of 4 variables:
$ anxiety : num 50.2 31.5 34 37.1 48.3 ...
$ flexibility: num 44.4 47.7 65.6 50.7 51.3 ...
$ mindfulness: chr "no" "yes" "no" "no" ...
$ activity : chr "pilates" "altro" "pilates" "altro" ...
| anxiety | flexibility | mindfulness | activity | |
|---|---|---|---|---|
| Min. : 1.483 | Min. :26.91 | Length:300 | Length:300 | |
| 1st Qu.:25.977 | 1st Qu.:44.24 | Class :character | Class :character | |
| Median :33.922 | Median :49.56 | Mode :character | Mode :character | |
| Mean :33.418 | Mean :50.34 | NA | NA | |
| 3rd Qu.:41.974 | 3rd Qu.:56.32 | NA | NA | |
| Max. :64.775 | Max. :82.41 | NA | NA |
| anxiety | flexibility | mindfulness | activity | |
|---|---|---|---|---|
| Min. : 1.483 | Min. :26.91 | Length:300 | Length:300 | |
| 1st Qu.:25.977 | 1st Qu.:44.24 | Class :character | Class :character | |
| Median :33.922 | Median :49.56 | Mode :character | Mode :character | |
| Mean :33.418 | Mean :50.34 | NA | NA | |
| 3rd Qu.:41.974 | 3rd Qu.:56.32 | NA | NA | |
| Max. :64.775 | Max. :82.41 | NA | NA |
Figura 3 illustrates different things. Figura 3 (a) and Figura 3 (c) illustrates Mindfulness aggregation, Figura 3 (b) and Figura 3 (d) illustrates Activity aggregation
ggplot(data,
aes(anxiety, flexibility, color = factor(mindfulness))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, color = factor(activity))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, shape = factor(mindfulness))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, shape = factor(activity))) +
geom_point()| anxiety | flexibility | mindfulness | activity |
|---|---|---|---|
| 50.17244 | 44.39524 | no | pilates |
| 31.47451 | 47.69823 | yes | altro |
| 34.03981 | 65.58708 | no | pilates |
| 37.06712 | 50.70508 | no | altro |
| 48.30549 | 51.29288 | no | altro |
| 16.94087 | 67.15065 | yes | altro |
| anxiety | flexibility | mindfulness | activity | |
|---|---|---|---|---|
| Min. : 1.483 | Min. :26.91 | Length:300 | Length:300 | |
| 1st Qu.:25.977 | 1st Qu.:44.24 | Class :character | Class :character | |
| Median :33.922 | Median :49.56 | Mode :character | Mode :character | |
| Mean :33.418 | Mean :50.34 | NA | NA | |
| 3rd Qu.:41.974 | 3rd Qu.:56.32 | NA | NA | |
| Max. :64.775 | Max. :82.41 | NA | NA |
The mean of the anxiety variable is 33.4179293
---
title: "L3-Quarto"
author: "GL"
date: today
format:
html:
self-contained: true
toc: true
toc-location: left
toc-title: My contents
grid:
sidebar-width: 300px
body-width: 900px
margin-width: 300px
gutter-width: 1.5rem
theme:
light: flatly
dark: darkly
fontsize: 20px
code-tools:
source: true
toggle: false
caption: This is my code
lang: it
citation-location: margin
execute:
echo: true
message: false
warning: false
error: true
code-fold: true
code-summary: See this specific code
code-annotations: hover
---
## Let's talk about rocks
```{r}
#| echo: fenced
#| eval: false
print(rock)
```
```{r}
#| code-summary: Look at me!
summary(rock)
```
## And now about anxiety and other stuff
```{r}
#| echo: false
data <- read.csv("data/dataset.csv")
str(data)
```
```{r}
#| code-summary: Look at me!
summary(data)
```
@fig-bb illustrates a baby wearing a nirs cap with frontal probes.
```{r}
#| out-width: 20%
#| fig-align: left
#| fig-cap: A baby with a nirs cap
#| fig-cap-location: bottom
#| label: fig-bb
#| code-summary: look how I've imported this nice pic! ;)
knitr::include_graphics("img/bb.png")
```
```{r}
#| include: false
library(ggplot2)
```
@fig-plot1 illustrates a plot
```{r}
#| out-width: 50%
#| fig-align: center
#| fig-cap: A graph from `mtcars`
#| fig-cap-location: margin
#| label: fig-plot1
#| code-summary: look how we directly plotted in Quarto (of course I copied Ottavia's code)
ggplot(mtcars, aes(hp, mpg, color = factor(am))) +
geom_point() +
geom_smooth(formula = y ~ x, method = "loess") +
theme(legend.position = 'bottom')
```
```{r}
#| include: false
library(kableExtra)
```
@tbl-table1 show the summary of the ChickWeight dataset
```{r}
#| echo: false
#| label: tbl-table1
#| fig-cap-location: margin
#| tbl-cap: "ChickWeight data summary"
kable(summary(ChickWeight)) %>%
scroll_box(height = "200px", width = "100%")
```
```{r}
#| lst-label: lst-tablecode
#| lst-cap: Code use to generate the previous table
#| eval: false
kable(summary(ChickWeight)) %>%
scroll_box(height = "200px", width = "100%")
```
::: {.callout-tip collapse="true"}
If you write *"#| eval: false"* in the previous code ref, quarto won't return a table twice
:::
```{r}
#| echo: false
data <- read.csv("data/dataset.csv")
str(data)
```
```{r}
#| echo: false
#| label: tbl-table2
#| fig-cap-location: bottom
#| tbl-cap: "Data Summary"
kable(summary(data))
```
```{r}
ggplot(data,
aes(anxiety, flexibility, color = factor(mindfulness))) +
geom_point() +
theme(legend.position = 'bottom')
```
```{r}
#| eval: true
#| fig-column: margin
ggplot(data,
aes(anxiety, flexibility, color = factor(mindfulness))) +
geom_point() +
theme(legend.position = 'bottom')
kable(summary(data))
```
```{r}
#| eval: true
ggplot(data, # <1>
aes(anxiety, flexibility, color = factor(mindfulness))) + # <2>
geom_point() + # <3>
theme(legend.position = 'bottom') # <4>
```
1. specify the dataset
2. specify variables
3. select the type of point
4. select the legend position
@fig-plotsModels illustrates different things. @fig-plotsModels-1 and @fig-plotsModels-3 illustrates *Mindfulness* aggregation, @fig-plotsModels-2 and @fig-plotsModels-4 illustrates *Activity* aggregation
```{r}
#| label: fig-plotsModels
#| layout-nrow: 2
#| layout-ncol: 2
#| fig-align: center
#| out-width: 100%
#| fig-cap: "One dataset, different graphical representations"
#| fig-subcap:
#| - "Mindfulness a"
#| - "Activity a"
#| - "Mindfulness b"
#| - "Activity b"
ggplot(data,
aes(anxiety, flexibility, color = factor(mindfulness))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, color = factor(activity))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, shape = factor(mindfulness))) +
geom_point()
ggplot(data,
aes(anxiety, flexibility, shape = factor(activity))) +
geom_point()
```
```{r}
#| label: tbl-tables
#| tbl-cap: "Datasets"
#| tbl-subcap:
#| - "Data"
#| - "DataSummary"
#| layout-ncol: 2
#|
kable(head(data))
kable(summary(data))
```
The mean of the anxiety variable is `r mean(data$anxiety)`